name: deploy on production 
run-name: ${{ github.actor }} is learning GitHub Actions
on: 
push:
  branches: ["master"]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: 'yarn'
      - name: build app
        run: "yarn build"
      - name: Install SSH Key
        uses: shimataro/ssh-key-action@v2
        with:
          key: ${{ secrets.SSH_SECRET_KEY }} 
          known_hosts: 'Something'
      - name: Adding Known Hosts
        run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
      - name: Remove dir from prod
        run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "rm -R /var/www/html/vuee"
      - name: Deploy to server
        run: rsync -avz ./dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/html/vuee
